import React from "react";
import { Switch, Route, Router, Redirect } from "react-router-dom";
import history from "./history";
import LoginSuess from "../left/sucess";
import loadable from "../loading/index";
const loginIndex = loadable(() => import("../pages/Login/index.jsx")),
  notFind = loadable(() => import("../component/404.jsx")),
  shopIndex = loadable(() => import("../pages/shop/index.jsx"));

const BrowserRouterObj = e => (
  <Router history={history}>
      <Switch>
      <Route exact path="/" component={loginIndex}></Route>
      <Route exact path="/main" component={LoginSuess}></Route>
      <Route path="/main/shop" component={shopIndex}></Route>
      {/* 404 或重定向到首页 */}
      <Route path="/404" component={notFind}></Route>
      <Redirect from="*" to="/404"></Redirect>
      </Switch>
  </Router>
);
export default BrowserRouterObj;
